package learning.groovy.classLoader

class CLEmbedGroovy {
	
	static main(args) {
		ClassLoader parent = CLEmbedGroovy.class.getClassLoader()
		GroovyClassLoader loader = new GroovyClassLoader(parent);

		Class<?> groovyClass = loader.parseClass(new File("./script/Persion.groovy"));
		
		GroovyObject groovyObject = (GroovyObject) groovyClass.newInstance();
		
		groovyObject.setProperty("name", "张三丰");
		groovyObject.setProperty("age", 26);

		System.out.println(groovyObject.invokeMethod("toString", null));
	}
}
